
********************************************************************************
* black racial resentment // high = "antiblack"
********************************************************************************

* 2010
gen favors10 = CC10_422a
recode favors10 1=5 2=4 3=3 4=2 5=1

gen slavery10 = CC10_422b
gen rr10 = ((favors10 + slavery10)-2)/8

* 2012
gen favors12 = CC12_422a
recode favors12 1=5 2=4 3=3 4=2 5=1

gen slavery12 = CC12_422b
gen rr12 = ((favors12 + slavery12)-2)/8

* 2014
gen favors14 = CC14_422a
recode favors14 1=5 2=4 3=3 4=2 5=1

gen slavery14 = CC14_422b
gen rr14 = ((favors14 + slavery14)-2)/8

* change in rr
gen rrchange = rr14-rr12
gen rrchange1410 =  rr14-rr10

********************************************************************************
* hispanic racial resentment // high = "antiblack"
********************************************************************************

* 2012
gen hispfavor12 = CC12_423aa
recode hispfavor12 1=5 2=4 3=3 4=2 5=1
gen hispslavery12 = CC12_423bb
gen hisp12 = ((hispfavor12 + hispslavery12)-2)/8

* 2014
gen hispfavor14 = CC14_423aa
recode hispfavor14 1=5 2=4 3=3 4=2 5=1
gen hispslavery14 = CC14_423bb
gen hisp14 = ((hispfavor14 + hispslavery14)-2)/8

* change in hisp
gen hispchange = hisp14-hisp12

********************************************************************************
* rescaling both favors
********************************************************************************

foreach x in hispfavor12 hispfavor14 favors12 favors14 {
sum `x' 
gen `x'_01 = (`x'-r(min))/(r(max)-r(min))
}

********************************************************************************
* ideology // high = conserv
********************************************************************************

* 2010 
gen ideo10= CC10_341A
recode ideo10 8=4
replace ideo10 = (ideo10-1)/6

* 2012
gen ideo12 = CC12_341A
recode ideo12 8=4
replace ideo12 = (ideo12-1)/6

gen ideo12_3 = ideo12
recode ideo12_3 0/.4999=0 .5=1 .51/1=2

* 2014
gen ideo14 = CC14_341A
recode ideo14 8=4
replace ideo14 = (ideo14-1)/6

********************************************************************************
* pid // high = republican
********************************************************************************

* 2010
gen pid10 = CC10_421a
recode pid10 1=0 2=1 3=.5
recode pid10 4=.

* 2012
gen pid12 = CC12_421a
recode pid12 1=0 2=1 3=.5
recode pid12 4=.

* 2014
gen pid14 = CC14_421a
recode pid14 1=0 2=1 3=.5
recode pid14 4=.

********************************************************************************
* obama // ordinal, approve = high
********************************************************************************

* 2010
gen obama10 = CC10_308a
recode obama10  1=4 2=3 3=2 4=1 5/99=.

* 2012
gen obama12 = CC12_308a
recode obama12 1=4 2=3 3=2 4=1 5/99=.

* 2014
gen obama14 = CC14_308a
recode obama14  1=4 2=3 3=2 4=1 5/99=.

********************************************************************************
* affirmative action // ordinal, high = oppose
********************************************************************************

* 2010
gen aa10 = CC10_327

* 2012
gen aa12 = CC12_327

* 2014
gen aa14 = CC14_327

********************************************************************************
* immigration // categorical, high = conservative
********************************************************************************

* amnesty 
* 2012
gen amnesty12 = ( CC12_322_1==2)
* 2014
gen amnesty14 = ( CC14_322_1==2)

* deny citizenship to american-born children
* 2012
gen nodaca12 = (CC12_322_6==1)
* 2014
gen nodaca14 = (CC14_322_6==1)

* fine businesses hiring illegals
* 2012
gen illegals12 = (CC12_322_4==1)
* 2014
gen illegals14 = (CC14_322_4==1)


********************************************************************************
* non-racial // high = conservative
********************************************************************************

* abortion ** ordinal **
* 2012
gen abort12 = CC12_324
recode abort12 4=1 3=2 2=3 1=4 5/99=.
* 2014
gen abort14 = CC14_324
recode abort14 4=1 3=2 2=3 1=4 5/99=.


* raise taxes ** categorical **
* 2012
gen raisetaxes12 = (CC12_328==3)
* 2014
gen raisetaxes14 = (CC14_328==3)

* climate change ** ordinal ** 
* 2012
gen cc12 = CC12_321
* 2014
gen cc14 = CC14_321

* gun control  **  ordinal ** 
* 2012
gen guncontrol12 = (CC12_320)
recode guncontrol12 2=3 3=2
* 2014
gen guncontrol14 = (CC14_320)
recode guncontrol14 2=3 3=2

* gay marriage
* 2012
gen gaymar12 = (CC12_326==1)
* 2014
gen gaymar14 = (CC14_326==1)

* birthright citizenship
* 2012
gen birthright12 = (CC12_322_6==1)
* 2014
gen birthright14 = (CC14_322_6==1)

* recoding policies to range from 0 to 1

foreach x in obama10 obama12 obama14 aa10 aa12 aa14 amnesty12 amnesty14 nodaca12 nodaca14 illegals12 illegals14 abort12 abort14 raisetaxes12 raisetaxes14 cc12 cc14 guncontrol12 guncontrol14 gaymar12 gaymar14{
sum `x' 
gen `x'_01 = (`x'-r(min))/(r(max)-r(min))
}

********************************************************************************
* demographics
********************************************************************************

gen age = 2014-birthyr_14
gen age01 = (age-22)/ 73
gen educ01 = (educ_14-1)/5
gen male = (gender_14==1)
gen white = (race_14==1)
gen black = (race_14==2)
gen hispanic = (race_14==3)
gen notpolactiv = (CC14_417a_6==1)
recode newsint_14 1=4 2=3 3=2 4=1 5=., gen( newsint )
gen newsint01 = (newsint-1)/3
gen income = faminc_14
recode income 32=14 97=.
